import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:test1/pages/widgets/Widget_Card_Page.dart';
import 'package:test1/pages/widgets/Widget_Center_Page.dart';

class Widget_CupertinoTabScaffold_Page extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return CupertinoTabScaffold(
        tabBar: CupertinoTabBar(
          items: [
            BottomNavigationBarItem(
              icon: Icon(CupertinoIcons.home,),
              title: Text("首页"),
            ),
            BottomNavigationBarItem(
              icon: Icon(CupertinoIcons.settings,),
              title: Text("设置"),
            ),
          ],
          activeColor: Colors.red,
          inactiveColor: Color(0xff333333),
          backgroundColor: Color(0xfff1f1f1),
          iconSize: 25.0,
        ),
        tabBuilder: (context, index) {
          return CupertinoTabView(
            builder: (context) {
              switch (index) {
                case 0:
                  return Widget_Center_Page();
                  break;
                case 1:
                  return Widget_Card_Page();
                  break;
              }
            },
          );
        }
    );
  }
}

/**
 *  ios风格的带选项卡页面布局
 *
 * const CupertinoTabScaffold({
    Key key,
    @required this.tabBar,//底部选项卡
    @required this.tabBuilder,//选项卡内容
    })
 */

/**
 *
 * CupertinoTabBar({
    Key key,
    @required this.items,
    this.onTap,//点击事件
    this.currentIndex = 0,//当前选中哪个选项卡
    this.backgroundColor = _kDefaultTabBarBackgroundColor,//背景色
    this.activeColor = CupertinoColors.activeBlue,//选中选项卡颜色
    this.inactiveColor = CupertinoColors.inactiveGray,//未选中选项卡颜色
    this.iconSize = 30.0,//按钮图标大小
    this.border = const Border(
    top: BorderSide(
    color: _kDefaultTabBarBorderColor,
    width: 0.0, // One physical pixel.
    style: BorderStyle.solid,
    ),
    ),
    })
 */

/**
 *
 * const CupertinoTabView({
    Key key,
    this.builder,//选项卡视图
    this.defaultTitle,//
    this.routes,//选项卡视图路由
    this.onGenerateRoute,//
    this.onUnknownRoute,//
    this.navigatorObservers = const <NavigatorObserver>[],//
    })
 */
